package tests;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class dbconnector {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while(sc.hasNextInt()){
            int n = sc.nextInt();
            int max = 0;
            Set<String > s = new HashSet<>();
            while(0!=n){
                String id,record;
                id = sc.next();
                record = sc.next();
                if(record.equals("connect"))
                    s.add(id);
                else
                    s.remove(id);
                n--;
                max=Math.max(max,s.size());
            }
            System.out.println(max);
        }

    }
}
